package com.ayu.scalalearn.chapter07

/**
  * @Author 徐林玉
  * @Description Test09Tuple
  * @Date 2022/8/16 14:04
  * @Version 1.0
  */
object Test09Tuple {

  def main(args: Array[String]): Unit = {

    //1、创建元组
    var tuple = (1, 2, 3, 4)
    println(tuple)


    //2、访问数据

    println(tuple._1)
    println(tuple._2)
    println(tuple._3)
    println(tuple._4)

    println("==================================")
    //3、遍历元组
    for (elem <- tuple.productIterator) {

      println(elem)
    }


    //4、嵌套元组
    var multuple = (1, 2, 3, (4, "scala"), 5)

    println(multuple._4._2)
  }

}
